/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.ruralLibrary.controller;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
import com.pig4cloud.pigx.common.security.annotation.Inner;
import com.pig4cloud.pigx.ruralLibrary.api.dto.FeedBackDto;
import com.pig4cloud.pigx.ruralLibrary.api.entity.FeedBack;
import com.pig4cloud.pigx.ruralLibrary.api.entity.ResourceAudit;
import com.pig4cloud.pigx.ruralLibrary.api.entity.ResourceEntity;
import com.pig4cloud.pigx.ruralLibrary.api.vo.ArticleCatalogVo;
import com.pig4cloud.pigx.ruralLibrary.service.FeedBackService;
import com.pig4cloud.pigx.ruralLibrary.service.ResourceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 资源
 *
 * @author pig
 * @date 2023-10-31 14:34:33
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/feedBack")
@Tag(description = "feedBack", name = "我的反馈")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class FeedBackController {

    private final FeedBackService feedBackService;

    /**
     * 分页查询
     *
     * @param page     分页对象
     * @param dto 资源
     * @return
     */
    @Operation(summary = "分页查询", description = "分页查询")
    @GetMapping("/page")
	@PreAuthorize("@pms.hasPermission('ruralLibrary_user_view')")
    public R getresourcePage(Page page, FeedBackDto dto) {
        LambdaQueryWrapper<FeedBack> wrapper = Wrappers.lambdaQuery();
		wrapper.eq(StrUtil.isNotBlank(dto.getSceneCode()), FeedBack::getSceneCode, dto.getSceneCode());
		wrapper.like(StrUtil.isNotBlank(dto.getSceneName()), FeedBack::getSceneName, dto.getSceneName());
		wrapper.like(StrUtil.isNotBlank(dto.getCreatedBy()), FeedBack::getCreatedBy, dto.getCreatedBy());
        return feedBackService.pageList(page, wrapper);
    }

}
